package com.yufu.geyan;

import com.getcapacitor.JSObject;

import org.json.JSONException;
import org.json.JSONObject;

public class PreLoginResult
{
  private String clientType;
  private String operatorType;
  private String processId;
  private String number;
  private String expiredTime;

  public PreLoginResult(String msg){
    JSONObject jsonObject = null;
    try {
      jsonObject = new JSONObject(msg);
      setProcessId(jsonObject.getString("process_id"));
      setOperatorType(jsonObject.getString("operatorType"));
      setClientType(jsonObject.getString("clienttype"));
      setNumber(jsonObject.getString("number"));
      setExpiredTime(jsonObject.getString("expiredTime"));
    }catch (JSONException ignored){
      System.out.println(ignored.getMessage());
    }
  }

  public JSObject getData(){
    JSObject data = new JSObject();
    data.put("number", getNumber());
    data.put("expired_time", getExpiredTime());
    data.put("client_type", getClientType());
    data.put("operator_type", getOperatorType());
    data.put("process_id", getProcessId());
    return data;
  }

  public void setNumber(String number) {
    this.number = number;
  }

  public String getNumber() {
    return number;
  }

  public void setExpiredTime(String expiredTime) {
    this.expiredTime = expiredTime;
  }

  public String getExpiredTime() {
    return expiredTime;
  }

  public void setClientType(String clientType) {
    this.clientType = clientType;
  }

  public String getClientType() {
    return clientType;
  }

  public void setOperatorType(String operatorType) {
    this.operatorType = operatorType;
  }

  public String getOperatorType() {
    return operatorType;
  }

  public void setProcessId(String processId) {
    this.processId = processId;
  }

  public String getProcessId() {
    return processId;
  }
}
